# -*- coding: utf-8 -*-
"""
@Project: base_python
@File: favorite_languages.py
@Author: PC
@Date: 2025/1/23
@Description: 
"""
favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
print("Sarah's favorite language is "+
    favorite_languages['sarah'].title()+
    ".")



user_0 = {
    'username':'efermi',
    'first':'enrico',
    'last':'fermi',
    }
for key,value in user_0.items():
    print("\nKey:"+key)
    print("Value:"+value)


favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
for name,language in favorite_languages.items():
    print(name.title()+"'s favorite language is "+
        language.title()+".")






favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
friends = ['phil','sarah']
for name in favorite_languages.keys():
    print(name.title())
    if name in friends:
        print("  Hi "+name.title()+
            ",I see your favorite language is "+
            favorite_languages[name].title()+"!")


favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
for name in sorted(favorite_languages.keys()):
    print(name.title()+",thank you for taking the poll.")


favorite_languages = {
    'jen':'python',
    'sarah':'c',
    'edward':'ruby',
    'phil':'python',
    }
print("The following languages have been mentioned:")
for language in set(favorite_languages.values()):
    print(language.title())



alien_0 = {'color':'green','points':5}
alien_1 = {'color':'yellow','points':10}
alien_2 = {'color':'red','points':15}
aliens = [alien_0,alien_1,alien_2]
for alien in aliens:
    print(alien)


print("==============================================================")
# 创建一个用于存储外星人的空列表
aliens = []
# 创建30个绿色的外星人
for alien_number in range(30):
    new_alien = {'color':'green','points':5,'speed':'slow'}
    aliens.append(new_alien)
for alien in aliens[:3]:
    if alien['color'] == "green":
        alien['color'] = "yellow"
        alien['points'] = 10
        alien['speed'] = 'medium'
    elif alien['color'] == "yellow":
        alien['color'] = "red"
        alien['points'] = 15
        alien['speed'] = 'fast'
# 显示前五个外星人
for alien in aliens[:5]:
    print(alien)

# 显示创建了多少个外星人
print("Total number of aliens:"+str(len(aliens)))
print("..............")
# 存储所点比萨的信息
pizza = {
    'crust':'thick',
    'toppings':['mushrooms','extra cheese'],
    }
# 概述所点的比萨
print("You ordered a "+pizza['crust']+"-crust pizza "+
    "with the following toppings:")
for topping in pizza['toppings']:
    print("\t"+topping)


users = {
    'aeinstein':{
        'first':'albert',
        'last':'einstein',
        'location':'princeton',
        },
    'mcurie':{
        'first':'marie',
        'last':'curie',
        'location':'paris',
        },
    }
for username,user_info in users.items():
    print("\nUsername:"+username)
    full_name = user_info['first']+" "+user_info['last']
    location = user_info['location']
    print("\tFull name:"+full_name.title())
    print("\tLocation:"+location.title())